package com.rmt.www.action;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.rmt.www.constant.ArtifactType;
import com.rmt.www.dao.ArtifactDao;
import com.rmt.www.dao.ProjectDao;
import com.rmt.www.dao.UserDao;
import com.rmt.www.service.AdminManageDetailService;
import com.rmt.www.vo.Artifact;
import com.rmt.www.vo.DesignArtifact;
import com.rmt.www.vo.FeatureArtifact;
import com.rmt.www.vo.ImplementationArtifact;
import com.rmt.www.vo.Project;
import com.rmt.www.vo.RequirementArtifact;
import com.rmt.www.vo.TestArtifact;
import com.rmt.www.vo.User;


public class SpecificAction extends ActionSupport{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public int aid;
	public String artifacttype;
	private FeatureArtifact featureArtifact;
	private RequirementArtifact requirementArtifact;
	private DesignArtifact designArtifact;
	private ImplementationArtifact implementationArtifact;
	private TestArtifact testArtifact;
	private AdminManageDetailService adminManageDetailService;
	
	public AdminManageDetailService getAdminManageDetailService() {
		return adminManageDetailService;
	}


	public void setAdminManageDetailService(
			AdminManageDetailService adminManageDetailService) {
		this.adminManageDetailService = adminManageDetailService;
	}


	public String execute(){
		if (artifacttype.equalsIgnoreCase(ArtifactType.FEATURE)) {
			featureArtifact = adminManageDetailService.getFeatureArtifact(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.REQUIREMENT)) {
			requirementArtifact = adminManageDetailService.getRequirementArtifact(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.DESIGN)) {
			designArtifact = adminManageDetailService.getDesignArtifact(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.IMPLEMENTATION)) {
			implementationArtifact = adminManageDetailService.getImplementationArtifact(aid);
		} else if (artifacttype.equalsIgnoreCase(ArtifactType.TESTCASE)) {
			testArtifact = adminManageDetailService.getTestArtifact(aid);
		}
		return "success";
	}


	public int getAid() {
		return aid;
	}


	public void setAid(int aid) {
		this.aid = aid;
	}


	public String getArtifacttype() {
		return artifacttype;
	}


	public void setArtifacttype(String artifacttype) {
		this.artifacttype = artifacttype;
	}


	public FeatureArtifact getFeatureArtifact() {
		return featureArtifact;
	}


	public void setFeatureArtifact(FeatureArtifact featureArtifact) {
		this.featureArtifact = featureArtifact;
	}


	public RequirementArtifact getRequirementArtifact() {
		return requirementArtifact;
	}


	public void setRequirementArtifact(RequirementArtifact requirementArtifact) {
		this.requirementArtifact = requirementArtifact;
	}


	public DesignArtifact getDesignArtifact() {
		return designArtifact;
	}


	public void setDesignArtifact(DesignArtifact designArtifact) {
		this.designArtifact = designArtifact;
	}


	public ImplementationArtifact getImplementationArtifact() {
		return implementationArtifact;
	}


	public void setImplementationArtifact(
			ImplementationArtifact implementationArtifact) {
		this.implementationArtifact = implementationArtifact;
	}


	public TestArtifact getTestArtifact() {
		return testArtifact;
	}


	public void setTestArtifact(TestArtifact testArtifact) {
		this.testArtifact = testArtifact;
	}
}
